﻿using System;
using System.Runtime.Serialization;

namespace PH.Model.Standards
{
    [DataContract]
    public class EvaluationModel:MBase
    {
        [Model(ConvertType = AttributeType.IgnoreUpdate)]
        [DataMember]
        public int ID { get; set; }
        [Model]
        [DataMember]
        public int GradeCode { get; set; }
        [Model]
        [DataMember]
        public byte Sex { get; set; }
        [Model]
        [DataMember]
        public int SubjectID { get; set; }
        [Model]
        [DataMember]
        public int Score { get; set; }
        [Model]
        [DataMember]
        public decimal Mark { get; set; }
        [Model]
        [DataMember]
        public string Description { get; set; }
        [Model]
        [DataMember]
        public bool Additional { get; set; }
        [DataMember]
        public string Level
        {
            get
            {
                if (Score >= 90)
                    return "优秀";
                else if (Score >= 80 && Score < 90)
                    return "良好";
                else if (Score >= 60)
                    return "及格";
                else
                    return "不及格";
            }
        }
    }

    [DataContract]
    public class EvaluationStandardCollection : ModelCollectionBase<EvaluationModel> { }

    public class EvaluationQuery : QueryBase
    {
        public int GradeCode { get; set; }
        public byte Sex { get; set; }
        public int SubjectID { get; set; }
        public bool? Additional { get; set; }
    }
}
